package org.jeecg.modules.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Data
@TableName("biz_equipment")
public class BizEquipmentEntity {
    @TableId(type = IdType.ASSIGN_ID)
    @Id
    @Column(name = "eq_id", nullable = false)
    @Dict(dictTable ="biz_equipment_state",dicText = "status",dicCode = "eq_id")
    @ApiModelProperty(value = "主键ID")
    private String eqId;
    @Basic
    @Column(name = "eq_code", nullable = false, length = 32)
    @ApiModelProperty(value = "设备编号 唯一依据")
    private String eqCode;
    @Basic
    @Column(name = "site_id", nullable = false)
    @ApiModelProperty(value = "站点id")
    @Dict(dictTable ="biz_site",dicText = "site_desc",dicCode = "site_id")
    private String siteId;
    @Basic
    @Column(name = "eq_name", nullable = false, length = 128)
    @ApiModelProperty(value = "设备名称")
    private String eqName;
    @Basic
    @Column(name = "company", nullable = true, length = 128)
    @ApiModelProperty(value = "单位名称")
    private String company;
    @Basic
    @Column(name = "eq_type", nullable = true)
    @ApiModelProperty(value = "设备类型（DTU设备、光伏子站计量设备、储能子站计量设备和用电户计量设备）")
    @Dict(dicCode = "dict_eq_type")
    private String eqType;
    @Basic
    @Column(name = "dtu_id", nullable = false, length = 32)
    @ApiModelProperty(value = "归属DTU设备ID")
    @Dict(dictTable ="biz_equipment",dicText = "eq_name",dicCode = "eq_id")
    private String dtuId;
    @Basic
    @Column(name = "modbus", nullable = false, length = 32)
    @ApiModelProperty(value = "设备地址码")
    private String modbus;
    @Basic
    @Column(name = "elect_type", nullable = false)
    @ApiModelProperty(value = "电表类型")
    @Dict(dicCode = "dict_elect_type")
    private String electType;
    @Basic
    @Column(name = "remark", nullable = false, length = 128)
    @ApiModelProperty(value = "备注")
    private String remark;
    @Basic
    @Column(name = "creator_id", nullable = false)
    @ApiModelProperty(value = "创建人ID 取登录信息")
    private Object creatorId;
    @Basic
    @Column(name = "create_time", nullable = false)
    @ApiModelProperty(value = "创建时间，取传入时间")
    private Timestamp createTime;
    @Basic
    @Column(name = "modifier_id", nullable = false)
    @ApiModelProperty(value = "修改人ID，取登录信息")
    private Object modifierId;
    @Basic
    @Column(name = "modify_time", nullable = false)
    @ApiModelProperty(value = "修改时间 自动更新")
    private Timestamp modifyTime;
    @Basic
    @Column(name = "status", nullable = false)
    @ApiModelProperty(value = "逻辑删除标识 1是未删除，0是已删除")
    @Dict(dicCode = "dict_item_status")
    private Object status;

    @Basic
    @Column(name = "use_in_count", nullable = false)
    @ApiModelProperty(value = "0 使用在首页的统计（目前只有发电量） 1 不使用")
    private Object useInCount;

    @TableField(exist = false)
    @JoinColumn(name = "onlineStatus",referencedColumnName = "status",table = "biz_equipment_state")
    private String onlineStatus;

    public String getEqId() {
        return eqId;
    }

    public void setEqId(String eqId) {
        this.eqId = eqId;
    }

    public String getEqCode() {
        return eqCode;
    }

    public void setEqCode(String eqCode) {
        this.eqCode = eqCode;
    }

    public String getSiteId() {
        return siteId;
    }

    public void setSiteId(String siteId) {
        this.siteId = siteId;
    }

    public String getEqName() {
        return eqName;
    }

    public void setEqName(String eqName) {
        this.eqName = eqName;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getEqType() {
        return eqType;
    }

    public void setEqType(String eqType) {
        this.eqType = eqType;
    }

    public String getDtuId() {
        return dtuId;
    }

    public void setDtuId(String dtuId) {
        this.dtuId = dtuId;
    }

    public String getModbus() {
        return modbus;
    }

    public void setModbus(String modbus) {
        this.modbus = modbus;
    }

    public String getElectType() {
        return electType;
    }

    public void setElectType(String electType) {
        this.electType = electType;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Object getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Object creatorId) {
        this.creatorId = creatorId;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Object getModifierId() {
        return modifierId;
    }

    public void setModifierId(Object modifierId) {
        this.modifierId = modifierId;
    }

    public Timestamp getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Timestamp modifyTime) {
        this.modifyTime = modifyTime;
    }

    public Object getStatus() {
        return status;
    }

    public void setStatus(Object status) {
        this.status = status;
    }

    public String getOnlineStatus() {
        return onlineStatus;
    }

    public void setOnlineStatus(String onlineStatus) {
        this.onlineStatus = onlineStatus;
    }

    public Object getUseInCount() {
        return useInCount;
    }

    public void setUseInCount(Object useInCount) {
        this.useInCount = useInCount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BizEquipmentEntity that = (BizEquipmentEntity) o;
        return electType == that.electType && Objects.equals(eqId, that.eqId) && Objects.equals(eqCode, that.eqCode) && Objects.equals(siteId, that.siteId) && Objects.equals(eqName, that.eqName) && Objects.equals(company, that.company) && Objects.equals(eqType, that.eqType) && Objects.equals(dtuId, that.dtuId) && Objects.equals(modbus, that.modbus) && Objects.equals(remark, that.remark) && Objects.equals(creatorId, that.creatorId) && Objects.equals(createTime, that.createTime) && Objects.equals(modifierId, that.modifierId) && Objects.equals(modifyTime, that.modifyTime) && Objects.equals(status, that.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(eqId, eqCode, siteId, eqName, company, eqType, dtuId, modbus, electType, remark, creatorId, createTime, modifierId, modifyTime, status);
    }
}
